import router from 'next/router'
import { Blist } from '../../services/book.service'
import styles from './style.module.scss'

interface Props {
  book: Blist
}

export default function Mainlist({ book }: Props) {

  return (
    <div className={styles.books} onClick={() => {
      router.push({ pathname: '/goods/' + book._id })
    }}>
      <img
        className={styles.banner}
        src={book.banner[0]}
        alt="banner" />
      <div className={styles.bookinfo}>
        <span className={styles.name}>{book.title}</span>
        <div className={styles.user}>
          <div className={styles.price}>
            <h3>¥ {book.lowprice}</h3>
          </div>
          <span className={styles.author}>{book.user.nickname}</span>
          <img src={book.user?.avatar} alt="" />
        </div>
        {/* <span className={styles.grade}>库存: {book.allstock}</span>*/}
      </div>
    </div>
  )
}
